<!-- 待审批订单页面 -->

<template>
	<view>
		<uni-section title="待审批订单列表" type="line" padding>
			<view class="uni-padding-wrap uni-common-mt">
				<view class="order-list" v-for="(item, index) in order_request_list" :key="index" >
					<uni-card v-if="item.rstatus != 3" :title="text[item.rstatus-1]" :sub-title="'报修单编号：' + item.rid" :extra="item.rarea" :thumbnail="order_picture" @click="enterOrderRequest(item)" >
						<text>{{item.rcontent}}</text>
					</uni-card>
				</view>
			</view>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				text: ['待分派', '请求重新分派', '', '请求结单'],
				items: ["未完成", "已完成", "已结单"],
				campus: [{
					text: '广州校区东校园',
					value: 0
				}, {
					text: '广州校园北校区',
					value: 1
				}, {
					text: '广州校区南校园',
					value: 2
				},{
					text: '深圳校区',
					value: 3
				},{
					text: '珠海校区',
					value: 4
				}],
				order_picture: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
				order_request_list: [
					{
						visited: true,
						rid: 10001,  //保修单序号
						rarea: '珠海校区',  //校园
						raddress: '中山大学珠海校区荔园7号-223',  //详细地址
						rcontent: "维修信息描述1",  //报修详情
						rtime: '2022-10-6 15:31:06',  //预约时间
						repairer_id: 0,  //维修人员编号
						user_id: 10001,  //报修人编号
						status: 4,  //状态
						repairer_img: [],  //完成图片
						user_img: [],  //报修图片
						user_status: 2,  //用户权限
						repairer_status: 0  //维修人员权限？
					},
					{
						visited: false,
						status: 2,
						rid: 10002,
						rcontent: "维修信息描述2",
						rarea: '珠海校区'
					},
					{
						visited: false,
						status: 1,
						rid: 10003,
						rcontent: "维修信息描述3",
						rarea: '深圳校区'
					},
					{
						visited: false,
						status: 4,
						rid: 10004,
						rcontent: "维修信息描述4",
						rarea: '广州校区南校区'
					},
					{
						visited: false,
						status: 1,
						rid: 10005,
						rcontent: "维修信息描述5",
						rarea: '珠海校区'
					},
					{
						visited: true,
						status: 2,
						rid: 10006,
						rcontent: "维修信息描述6",
						rarea: '广州校区东校园'
					},
					{
						visited: true,
						status: 3,
						rid: 10007,
						rcontent: "维修信息描述7",
						rarea: '珠海校区'
					}
				]
			}
		},
		methods: {
			enterOrderRequest(order) {
				console.log("跳转到订单确认页")
				uni.navigateTo({
					url: "../order/order_request?order=" + JSON.stringify(order)
				});
			},
			getMessage() {
				uni.request({
				    url: 'http://localhost:8081/repair/unchecked_repairment', 
					success: (res) => {
						console.log(res.data.data);
						if (res.data.code == "200") {
							this.order_request_list = res.data.data;
						}
					}
				});
			}
		},
		onLoad() {
			this.getMessage()
		}
	}
</script>

<style>
	.uni-padding-wrap {
		width: 710rpx;
		padding: 0px 0px;
	}
	.uni-common-mt {
		margin-top: 0px;
	}
</style>